package com.joker.yuwu;

import com.joker.repository.SearchYdZhanguan;
import com.joker.repository.SearchYdZhanguan1;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

//查询用户预定展馆的信息
//用户查询

@WebServlet("/searchydzg1")
public class SearchYdzg1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        super.doGet(req, resp);
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/json; charset=utf-8");
        String username=req.getParameter("username");
        SearchYdZhanguan1 s1=new SearchYdZhanguan1();
        ArrayList<JSONObject> list=new ArrayList<>();
        list=s1.show(username);
        System.out.println(list.toString());
        JSONObject array=new JSONObject();
        array.put("data",list);
        resp.getWriter().write(array.toString());

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
